package com.mall.config;

import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//阿里云上传配置 
@Configuration
public class OssConfiguration {
    @Value("${lximage.read.keyid}")
    String accessKeyId;
    @Value("${lximage.read.keysecret}")
    String accessKeySecret;
    @Value("${lximage.endpoint}")
    String endpoint;

    @Bean
    OSSClient ossClient() {
        return new OSSClient(this.endpoint, new DefaultCredentialProvider(this.accessKeyId,  this.accessKeySecret),new ClientBuilderConfiguration());
    }

}